package com.example.module_attendance

import androidx.lifecycle.MutableLiveData
import com.yuwei.base.BaseViewModel
import com.yuwei.http.ApiService
import com.yuwei.http.entity.AttendancesEntity
import com.yuwei.http.entity.AttendancesEntityItem
import com.yuwei.http.entity.SendAttendancesBody
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class AttendanceViewModel @Inject constructor(
    val apiService: ApiService
):BaseViewModel(){
    val getAttendancesSuccess by lazy { MutableLiveData<AttendancesEntityItem>() }
    fun getAttendances(sendAttendancesBody: SendAttendancesBody){
        executeNetwork({
            apiService.sendAttendances(sendAttendancesBody)
        },getAttendancesSuccess::postValue)
    }

    val getAttendancesSuccessMinutes by lazy { MutableLiveData<AttendancesEntity>() }
    fun getMinutesAttendances(id:Int){
        executeNetwork({
            apiService.getAttendances(id)
        },getAttendancesSuccessMinutes::postValue)
    }

}